/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.sitetune.integration;

import com.thoughtworks.selenium.DefaultSelenium;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;

/**
 *
 * @author marcos.junqueira
 */
public abstract class AbstractSeleniumTestCase {

    protected DefaultSelenium selenium;
    private String serverHost = "localhost";
    private String serverPort = "4444";
    private String browser = "*googlechrome";
    private String url = "http://localhost/";

    @BeforeClass(alwaysRun = true)
    @Parameters({"selenium.host", "selenium.port", "selenium.browser", "selenium.url"})
    public void setUp(String serverHost, String serverPort, String browser, String url) {
        this.serverHost = serverHost;
        this.serverPort = serverPort;
        this.browser = browser;
        this.url = url;
        selenium = new DefaultSelenium(serverHost, Integer.parseInt(serverPort),
                browser, url);
        selenium.start();
    }

    @AfterClass(alwaysRun = true)
    public void tearDown() {
        selenium.stop();
    }
}
